import * as actionTypes from './actionTypes';

const defaultState = {
    scoreCellData: [],
    scoreCellImg: []
};

export default (state = defaultState, action) => {
	const newState = JSON.parse(JSON.stringify(state)) 
	switch(action.type) {
        case actionTypes.Get_Score_Particulars:
            action.data.IMG = action.data.IMG.split(',');
            newState.scoreCellImg = action.data.IMG; 
            newState.scoreCellData = action.data;
            console.log(newState)
            return newState;
        case actionTypes.Add_Score_Collect:
			if (newState.scoreCellData) {
				newState.scoreCellData.FAVORITE_ID = '10086'
			}
			return newState;
		case actionTypes.Sub_Score_Collect:
            if (newState.scoreCellData) {
                newState.scoreCellData.FAVORITE_ID = ''
            }
			return newState;	
		default:
			return state;
	}
}